package tamtoucan.friendly.client;

import net.minecraft.client.Minecraft;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe;
import tamtoucan.friendly.ModConstants;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class SoundHandler {

    @SideOnly(Side.CLIENT)
    @ForgeSubscribe
    public void onSoundLoad(SoundLoadEvent event) {

    	final String[] sounds = { ModConstants.SOUND_CREEPER_SAY1, ModConstants.SOUND_CREEPER_SAY2 };
    	for (String s : sounds) {
    		try {
    			s = s.replaceAll("\\.", "/") + ".ogg";
    			Minecraft.getMinecraft().getLogAgent().logInfo("[TameableCreepers] Load sound: "+s);
    			event.manager.soundPoolSounds.addSound(s);
    		} catch(Exception e) {
    			Minecraft.getMinecraft().getLogAgent().logWarning("Failed to load sound: "+s);
    		}
    	}
    }
}